package com.zyp.iterator;

import java.util.List;

/**
 * 模拟集合接口，包含新增，删除等功能
 * @author Administrator
 *
 */
public interface MyContainer {
	
	
	public void add(Object o);
	
	
	public void remove(Object o);
	
	
	public MyIterator iterator();

}


/**
 * 模拟集合类
 * @author Administrator
 *
 */
class ConcreateContainer implements MyContainer{

	private List<Object> list;
	
	public ConcreateContainer(List<Object> list){
		this.list=list;
	}
	
	@Override
	public void add(Object o) {
		list.add(o);
	}

	@Override
	public void remove(Object o) {
		list.add(o);
	}

	@Override
	public MyIterator iterator() {
		return new MyConcreateIterator(list);
	}
	
}